package org.example.myleet.p1460;

public class Solution {
    public boolean canBeEqual(int[] target, int[] arr) {
        int[] counts = new int[1001];
        for (int i = 0; i < target.length; ++i) {
            ++counts[target[i]];
            --counts[arr[i]];
        }
        for (int i = 0; i < 1001; ++i) {
            if (counts[i] != 0) {
                return false;
            }
        }
        return true;
    }
}
